import React, { Component, PropTypes } from 'react';
import ReactDOM from 'react-dom';
import SearchResult from './SearchResult';
import NodesList from './NodesList';
import NodeCreator from '../NodeCreator';
import NodeEditor from '../NodeEditor';
import NodeView from '../NodeView';
import RelationEditor from '../RelationEditor';
import RelationList from './RelationList';
import RelationCreator from '../RelationCreator';
import SearchList from '../SearchList';
import RelationListSearch from '../SearchList/RelationListSearch';
import TopologyListSearch from '../SearchList/TopologyListSearch';
import { Route, IndexRoute } from 'react-router';
import { Router, hashHistory } from 'react-router';

export default class Workspace extends Component {
	constructor(props) {
		super(props);
	}
	static childContextTypes = {
    hello: PropTypes.number,
    getSearchType: PropTypes.func
  };
  getChildContext() {
    return {
      hello: 1,
      getSearchType: this.props.getSearchType
    };
  }
	render() {
		const routes = (
			<Route path="/">
				<IndexRoute component={NodesList}/>
				<Route path="nodeslist" component={NodesList}/>
				<Route path="nodecreator" component={NodeCreator}/>
        <Route path="searchresult" component={SearchResult}/>
        <Route path="nodeeditor/:id" component={NodeEditor}/>
        <Route path="nodeview/:id" component={NodeView}/>
        <Route path="relationlist" component={RelationList}/>
        <Route path="relationcreator" component={RelationCreator}/>
        <Route path="relationeditor/:id" component={RelationEditor}/>
        <Route path="search">
	        <IndexRoute component={SearchList}/>
	        <Route path="relation" component={RelationListSearch}/>
	        <Route path="topology" component={TopologyListSearch}/>
	      </Route>
    	</Route>
		)
		return (
			<div className="workspace">
				<Router history={hashHistory} routes={routes} />
				{/*<SearchResult getSearchType={this.props.getSearchType}/>*/}
			</div>
		)
	}
}
